<?php
$dbhost = 'localhost';  // mysql服务器主机地址
$dbuser = 'ether_gq';            // mysql用户名
$dbpass = '8MN6ZYmayNbRwxm7';          // mysql用户名密码
$dbname = 'ether_gq';
$conn = mysqli_connect($dbhost, $dbuser, $dbpass,$dbname);


$a='SELECT * FROM user WHERE username='."'".$_GET["friendname"]."'";
$sql=mysqli_query($conn,$a);

$row = mysqli_fetch_array($sql);

$friends_list=$row[4];
$friends_list=json_decode($friends_list,true);

$key = array_search($_GET["username"],$friends_list['request_add_friends']);
if(!($key === false)){
    unset($friends_list['request_add_friends'][$key]);
};

$friends_list=json_encode($friends_list);

$a='UPDATE user SET request_add_friends=\''.$friends_list.'\' WHERE username=\''.$_GET['friendname'].'\'';

if(mysqli_query($conn,$a)){
    echo '1';
};


mysqli_close($conn);


?>